
import requset from './requset'

// 获取图书
const ReBooks = data => requset({
  url: 'books',
  method: 'GET'
})
// 添加图书
const addBooks = data => requset({
  url: 'books',
  method: 'POST',
  data
})
// 根据id查询图书信息
const findBooks = id => requset({
  url: `books/${id}`,
  method: 'GET'
})
// 编辑图书信息
const edibooks = (id, data) => requset({
  url: `books/${id}`,
  method: 'PUT',
  data
})
// 删除图书信息
const delbooks = id => requset({
  url: `books/${id}`,
  method: 'DELETE'
})
// 验证图书是否存在
const verifybooks = name => requset({
  url: `books/book/${name}`,
  method: 'GET'
})
export const ReBooksAPI = ReBooks
export const addBooksAPI = addBooks
export const findBooksAPI = findBooks
export const edibooksAPI = edibooks
export const delbooksAPI = delbooks
export const verifybooksAPI = verifybooks
